package com.saturn.action.system.dict.test;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.saturn.app.db.ListData;
import com.saturn.app.utils.JSONUtils;
import com.saturn.app.web.IAction;
import com.saturn.app.web.IView;
import com.saturn.app.web.easyui.DataGridInfo;
import com.saturn.app.web.view.JsonView;
import com.saturn.system.DictTest;

public class ListDictTestAction implements IAction {

	public IView execute(HttpServletRequest request,
			HttpServletResponse response) {

		DataGridInfo dataGridInfo = new DataGridInfo(request);

		DictTest dictTest = new DictTest(request.getParameter("id"), request
				.getParameter("test1"), request.getParameter("test2"), request
				.getParameter("test3"), request.getParameter("test4"), request
				.getParameter("type1Name"), request.getParameter("type2Name"),
				request.getParameter("type3Name"), request
						.getParameter("type4Name"));

		ListData<DictTest> data = DictTest.getDicts(dictTest, dataGridInfo
				.getStartPage(), dataGridInfo.getRows(), dataGridInfo
				.getSortId(), dataGridInfo.getOreder());

		return new JsonView(JSONUtils.getDataGridJSON(data.getTotal(), data
				.getList()));
	}

	public String requestMapping() {
		return "/system/dict/listDictTests.action";
	}

}
